<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>打印采购单</title>
    <link rel="shortcut icon" href="/web/static/src/img/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="/web/static/src/css/full.css">
    <link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css">
    <link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/web/static/src/css/base.css">

    <script language="javascript" src="/lodop/static/lib/lodop6/LodopFuncs.js"></script>
    <script language="javascript" src="/lodop/static/src/js/mathlibrary.js"></script>

    <style type="text/css" id="style">
        body{padding: 10px; font-size: 10pt}

        @media print
        {
            .print-hide {display:none}
        }

        .td_inline {
            display:block;
            overflow:hidden;
            white-space:nowrap;
            text-overflow:ellipsis;
            width: 370pt;
        }

        .nowrap{
            white-space:nowrap;
        }

        .curPre {

        }

        .table thead tr td{font-weight: bold; font-size: 11pt; }

        h4{margin: 0px;  padding: 0px;font-size: 14pt}

        h5{
            font-size:11pt; font-family:'黑体'; font-weight: bold; margin: 0px;  padding: 0px;
        }

        div{font-size: 10pt}

        span.foot_sign{border-bottom: 1px solid #ddd}

        .table tbody tr td{border-top: 1px solid #ddd;}
        .table tbody tr:last-child td{border-top: 1px solid #ddd;}
        .table tbody tr.memo td {padding:0px; border-top:0px }

        td{font-size:10pt}

        .font-middle{
            font-size: 12pt;
        }

        .page_head{
            padding-bottom: 20px;
        }

        .bottom-line{
            border-bottom:1px solid #DDD;
        }


    </style>
</head>

<body>
    <object  id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
        <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
    </object>

    <!-- lodop 控制脚本 -->
    <div class="controls controls-row print-hide">
        <script>
            function CheckIsInstall() {
                try{
                    window.LODOP = getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
                    //if ((LODOP!=null)&&(typeof(LODOP.VERSION)!="undefined")) alert("本机已成功安装过Lodop控件!\n  版本号:"+LODOP.VERSION);
                    return true;
                }catch(err){
                    //alert("Error:本机打印控件未安装或需要升级!");
                }
            };

            function print_preview(){
                LODOP.PRINT_INIT("采购单");
                LODOP.ADD_PRINT_HTM(0,0,"100%","100%", '<body>' +
                        '<link rel="stylesheet" type="text/css" href="/resources/bootstrap/css/bootstrap.min.css">'+
                        document.documentElement.innerHTML +
                        '</body>');
                LODOP.PREVIEW();
            };
        </script>

        注: 打印A4纸按Ctrl+P键，或者菜单上面选择文件->打印，文件->页面设置里面可以去除页眉页脚

    </div>

    <br/>

    <!-- 出库单据表头 -->
    <div id="div-header">
        <table border="0" cellSpacing="0" cellPadding="0" width="100%">
            <tbody>
                <tr>
                    <td align="center" colspan="4">
                        <h4 class="page_head">{{purchase_order.company_id.name}}采购单</h4>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" width="50%">
                        □紧急&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        □请审阅&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        □批注&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        □请答复
                    </td>
                    <td colspan="2">
                         <span style="font-size: 12pt;font-weight: bold;">订单编号: {{purchase_order.name}}</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2" width="50%">
                        供应商:
                        {% if purchase_order.partner_id.is_company %}
                            {{ purchase_order.partner_id.name|default('', True) }}
                        {% else %}
                            {{ purchase_order.partner_id.parent_id.name|default('', True) }}
                        {% endif %}
                    </td>
                    <td colspan="2" width="50%">
                        日期:
                        {%if purchase_order.date_order%}
                            {{ purchase_order.date_order|strftime('%Y-%m-%d')}}
                        {%endif%}
                    </td>
                </tr>
                <tr>
                    <td class="bottom-line">
                        联系人:
                        {% if purchase_order.partner_id.is_company %}
                            {{ purchase_order.partner_id.principal|default('', True) }}
                        {% else %}
                            {{ purchase_order.partner_id.name|default('', True) }}
                        {% endif %}
                    </td>
                    <td class="bottom-line">
                        电话:
                        {% if purchase_order.partner_id.phone %}
                            {{ purchase_order.partner_id.phone}}
                        {% elif purchase_order.partner_id.mobile %}
                            {{ purchase_order.partner_id.mobile}}
                        {% endif %}
                    </td>
                    <td colspan="2" width="50%" class="bottom-line">
                        传真:
                        {%if purchase_order.partner_id.fax%}
                            {{purchase_order.partner_id.fax|default('', True)}}
                        {%endif%}
                    </td>
                </tr>

                <tr>
                    <td colspan="4">
                        买家:
                        {% if purchase_order.company_id %}
                            {{ purchase_order.company_id.name|default('', True) }}
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>
                        联系人:{{purchase_order.validator.name|default('', True)}}
                    </td>
                    <td>
                        电话:
                        {% if purchase_order.company_id %}
                            {{ purchase_order.company_id.phone|default('', True)}}
                        {% endif %}
                    </td>
                    <td colspan="2" width="50%">
                        传真:
                        {%if purchase_order.company_id%}
                            {{ purchase_order.company_id.fax|default('', True)}}
                        {%endif%}
                    </td>
                </tr>
            </tbody>
        </table>
    </div>

    <br/>

    <!-- 出库单据表身 -->
    <div id="div-body">
        <table class="table table-striped" width="100%">
            <thead>
            <tr>
                <td width="60" style="text-align: left;">#</td>
                <td class="nowrap">产品名称</td>
                <td class="nowrap"></td>
                <td class="nowrap"></td>
                <td class="nowrap"></td>
                <td class="nowrap" style="text-align: right;">数量</td>
            </tr>
            </thead>
            <tbody>
                {% for line in purchase_order.order_line %}
                <tr>
                    <td align="left" >
                        {% if loop.index < 10 %}
                            0{{loop.index}}
                        {% else %}
                            {{loop.index}}
                        {%endif%}
                    </td>
                    <td colspan="4">
                        <div>
                            <span>
                                {{line.name}}
                            </span>
                        </div>
                    </td>
                    <td style="text-align: right;">
                        {{line.product_qty|int()}}
                    </td>

                </tr>
                {% endfor %}
            </tbody>
        </table>

        备注：
        <table class="table table-striped" width="100%">
            {% if purchase_order.notes %}
            {% for line in purchase_order.notes.split('\n') %}
            <tr class="memo">
                <td>
                    {{ line }}
                </td>
            </tr>
            {% endfor %}
            {% endif %}
        </table>
        &nbsp;<br/>

        采购员：<u>{{curUser.name}}</u>　主管:<u>　　　　　</u>　财务：<u>　　　　　　</u> .

    </div>

    <!-- 出库单据表尾 -->
    <div id="div-foot">

    </div>

</body>
</html>
